package org.kabanyo.components.supportClasses {

	import mx.core.UIComponent;
	import mx.events.ToolTipEvent;

	import org.kabanyo.components.IToolTipRenderer;

	import spark.components.SkinnableContainer;

	public class ToolTipRenderer extends SkinnableContainer implements IToolTipRenderer {

		private var _text:String;

		[Bindable]
		/**
		 * Implement required text setter and getter of the IToolTipRenderer interface.
		 */
		public function get text():String {
			return _text;
		}

		/**
		 * @private
		 */
		public function set text(value:String):void {
			_text=value;
		}

		private var _data:Object;

		[Bindable]
		public function get data():Object {
			return _data;
		}

		public function set data(value:Object):void {
			_data=value;
		}

		public function ToolTipRenderer() {
			super();
		}

		public function initiateToolTip(component:UIComponent):void {
			component.toolTip=" ";
			component.addEventListener(ToolTipEvent.TOOL_TIP_CREATE, createToolTip);
		}

		private function createToolTip(event:ToolTipEvent):void {
			event.toolTip=this;
		}

	}
}
